//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet.StandardAddIn
{
    internal struct Date360
    {
        private readonly int Day;
        private readonly int Month;
        private readonly int Year;

        public Date360(DateTime dt, bool method)
        {
            Year = dt.Year;
            Month = dt.Month;
            Day = dt.Day;
            if (Day == 31)
            {
                if (method)
                {
                    Day = 30;
                }
                else
                {
                    Month++;
                    Day = 1;
                }
            }
        }

        public int Days
        {
            get { return Day + Month*30 + Year*12*30; }
        }

        public static int operator -(Date360 a, Date360 b)
        {
            return a.Days - b.Days;
        }
    }
}